import { ApiTags } from '@nestjs/swagger/dist/decorators';
import { Body, Controller, Get, Param, Patch, Query } from '@nestjs/common';
import { UpdateWxAppConfigDto } from './dto/update-wx-app-config.dto';
import { WxAppConfigService } from './wx-app-config.service';

@ApiTags('小程序配置管理')
@Controller('wxappconfig')
export class WxAppConfigController {
  constructor(private readonly wxAppConfigService: WxAppConfigService) {}

  @Get('key')
  async getOneByKey(@Query() query: { configKey: string }) {
    return await this.wxAppConfigService.getOneByKey(query.configKey)
  }

  @Patch(':id')
  async updateWxAppConfig(@Param('id') id: string, @Body() dto: UpdateWxAppConfigDto) {
    return await this.wxAppConfigService.updateWxAppConfig(id, dto)
  }

}
